<template>
	<div class="productInfomation">
		<div class="backIcon" @click="go">
			<!--<img :src="backIcon" alt="" />-->
			<i class="el-icon-erp-fanhui"></i>
		</div>		
		<swiper :imgList="imgList"></swiper>
		<information :productInformation="productInformation" :isMember="isMember"></information>
		<introduce :productInformation="productInformation"></introduce>
		<purchase :price="price" :cash="cash" :productid="productid" :statu="statu"></purchase>	
		<div id="result"></div>
	</div>
</template>

<script>
import swiper from '@/components/m-swiper/swiper'
import information from '@/components/m-productinformation/information'
import introduce from '@/components/m-productinformation/introduce'
import purchase from '@/components/m-productinformation/purchase'

export default {
	name: "productInfomation",
	components: {
		swiper,
		information,
		introduce,
		purchase,
	},
	data() {
		return {
			backIcon: require("../../assets/product/back.jpg"),
			productId: '',
			imgList: {},
			productInformation: {},
			songReady: false,
			currentTime: 0,
			price: 0,
			cash: 0,
			productid: 0,
			statu:0,
			isMember:false
		}
	},
	created() {
		this.getParams()
		this.getProductInfomation()
	},
	mounted() {
		
	},
	methods: {
		//获取产品详情
		getProductInfomation() {
			this.$http.get(this.$store.state.reqUrl + '/products/' + this.productId, {}).then(res => {
				if(res.status == 200) {
					this.imgList = res.data.images;
					this.productInformation = res.data;
					this.$store.state.active_data = res.data.favourables;
					this.price = res.data.price;					
					this.productid = res.data.id;
					this.statu = res.data.statu;
					if(this.isMember){ 
						this.cash = res.data.memberRentPrice;
					}else{
						this.cash = res.data.deposit;
					}
				}
			})
		},		
		go() {
			this.$router.go(-1)
		},
		getParams() {
			this.productId = this.$route.query.product_id;	
			if(typeof(this.$route.query.isMember) == 'string') {
				if(this.$route.query.isMember == "true") {
					this.isMember = true
				}else{
					this.isMember = false
				}				
			}else{
				this.isMember = this.$route.query.isMember
			}
		}
	}
}
</script>

<style lang="less" scoped>
  .productInfomation{
  	  width:100%;
  	  .backIcon{
  	  	position:fixed;
  	  	left:0;
  	  	top:0;
  	  	z-index:99;
  	  	/*img{
  	  		width:60px;
  	  		height: 60px;
  	  	}*/
  	  	i{
  	  		font-size: 60px;
  	  	}
  	  }
  }
</style>